package com.qf.service;

import com.qf.dao.DqAlbumsMapper;
import com.qf.dto.DqAlmusDTO;
import com.qf.pojo.DqAlbums;
import com.qf.utils.DateUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.ParseException;

/**
 * //                       .::::.
 * //                     .::::::::.
 * //                    :::::::::::  come on
 * //                 ..:::::::::::'
 * //              '::::::::::::'
 * //                .::::::::::
 * //           '::::::::::::::..
 * //                ..::::::::::::.
 * //              ``::::::::::::::::
 * //               ::::``:::::::::'        .:::.
 * //              ::::'   ':::::'       .::::::::.
 * //            .::::'      ::::     .:::::::'::::.
 * //           .:::'       :::::  .:::::::::' ':::::.
 * //          .::'        :::::.:::::::::'      ':::::.
 * //         .::'         ::::::::::::::'         ``::::.
 * //     ...:::           ::::::::::::'              ``::.
 * //    ```` ':.          ':::::::::'                  ::::..
 * //                       '.:::::'                    ':'````..
 * //
 *
 * @author:小川
 * @date: 2018/11/24 16:14
 */
@Service
public class DqAlmusServiceImpl implements DqAlmusService {
    @Autowired
    private DqAlbumsMapper dqAlbumsMapper;
    @Override
    public void addAlmus(DqAlmusDTO dqAlmusDTO) throws ParseException {
        DqAlbums dqAlbums=new DqAlbums();
        BeanUtils.copyProperties(dqAlmusDTO,dqAlbums);
        dqAlbums.setCreatedAt(DateUtils.stringToDate(dqAlmusDTO.getCreatedAt()));
        dqAlbums.setUpdatedAt(DateUtils.stringToDate(dqAlmusDTO.getUpdatedAt()));
        dqAlbumsMapper.insert(dqAlbums);
    }
}
